package com.konghao.test.junit.servlet;

import com.konghao.test.junit.model.User;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * LoginServlet--JunitTest
 *
 * @author: Jovi
 * @createTime: 2017-10-30 10:39
 **/
public class LoginServlet extends HttpServlet {

    public boolean isLogin(HttpServletRequest request) {

        HttpSession session = request.getSession();

        if (session == null) {
            return false;
        }

        User u = (User) session.getAttribute("loginUser");
        if (u == null) {
            return false;
        } else {
            return true;
        }
    }


}
